package com.eshore.norm.enumeration;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Project:cmp-euler
 * Package:com.eshore.cmdb.enumeration
 *
 * @author zhangzy
 * @date 2021/3/5 9:52
 */
public enum CloudTypeEnum {
    /**
     * 私有云
     */
    PRIVATE(1),
    /**
     * 公有云
     */
    PUBLIC(2),
    ;

    @EnumValue
    @JsonValue
    private final int type;

    CloudTypeEnum(int type) {
        this.type = type;
    }

    public int getType() {
        return type;
    }

    @JsonCreator
    public static CloudTypeEnum valOf(Integer type) {
        if (type == null) {
            return null;
        }

        for (CloudTypeEnum value : values()) {
            if (value.type == type) {
                return value;
            }
        }
        return null;
    }
}
